tg-me.com/python_codes/204
Create:
Last Update:
Last Update:
Time complexity in above Picture
Fibonacci Number using Dynamic Programming:
CODE:
calculated = {}
Share and Support
def fib(n):
if n == 0: # base case 1
return 0
if n == 1: # base case 2
return 1
elif n in calculated:
return calculated[n]
else: # recursive step
calculated[n] = fib(n-1) + fib(n-2)
return calculated[n]
@Python_Codes
BY Python Codes

Share with your friend now:
tg-me.com/python_codes/204